]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Adapt to mutter moving to GSettings
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 27 Jun 2011 01:54:26 +0000 (03:54 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 11 Nov 2011 19:32:43 +0000 (20:32 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=663429

configure.ac
data/Makefile.am
data/gnome-shell.schemas [deleted file]
data/org.gnome.shell.gschema.xml.in
js/ui/altTab.js
js/ui/lookingGlass.js
js/ui/main.js
js/ui/status/accessibility.js
js/ui/windowManager.js
js/ui/workspace.js
src/main.c

index 1304baae9225ea9f1a02c3648b2f71c863cab75e..d15b88a1960efd11356beda63bc03d055d6c45e4 100644 (file)
@@ -36,10 +36,6 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
 
 PKG_PROG_PKG_CONFIG([0.22])
 
-# GConf stuff
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
-AM_GCONF_SOURCE_2
-
 GLIB_GSETTINGS
 
 # Get a value to substitute into gnome-shell.in
index eaec30befa6c2c34991cbc80e5063df3956a87e3..287b99d705518c6cd8f976a941fb8cc206c787d2 100644 (file)
@@ -60,23 +60,14 @@ gschemas.compiled: $(gsettings_SCHEMAS:.xml=.valid)
 all-local: gschemas.compiled
 
 
-# GConf schemas: provide defaults for keys from Metacity we are overriding
-gconfschemadir  = @GCONF_SCHEMA_FILE_DIR@
-gconfschema_DATA = gnome-shell.schemas
-
 shadersdir = $(pkgdatadir)/shaders
 shaders_DATA = \
        shaders/dim-window.glsl
 
-install-data-local:
-       GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$(gconfschema_DATA)
-
-
 
 EXTRA_DIST =                                           \
        gnome-shell.desktop.in.in                       \
        $(menu_DATA)                                    \
-       $(gconfschema_DATA)                             \
        $(shaders_DATA)                                 \
        org.gnome.shell.gschema.xml.in
 
diff --git a/data/gnome-shell.schemas b/data/gnome-shell.schemas
deleted file mode 100644 (file)
index f2e69ee..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-<gconfschemafile>
-    <schemalist>
-
-      <!-- Metacity overrides -->
-      <schema>
-        <key>/schemas/desktop/gnome/shell/windows/attach_modal_dialogs</key>
-        <applyto>/desktop/gnome/shell/windows/attach_modal_dialogs</applyto>
-        <owner>gnome-shell</owner>
-        <type>bool</type>
-        <default>true</default>
-        <locale name="C">
-          <short>Attach modal dialog to the parent window</short>
-          <long>
-             This key overrides /apps/mutter/general/attach_modal_dialogs when
-             running GNOME Shell.
-          </long>
-        </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/desktop/gnome/shell/windows/button_layout</key>
-        <applyto>/desktop/gnome/shell/windows/button_layout</applyto>
-        <owner>gnome-shell</owner>
-        <type>string</type>
-        <default>:close</default>
-        <locale name="C">
-           <short>Arrangement of buttons on the titlebar</short>
-           <long>
-             Arrangement of buttons on the titlebar. The
-             value should be a string, such as
-             "menu:minimize,maximize,spacer,close"; the colon separates the
-             left corner of the window from the right corner, and
-             the button names are comma-separated. Duplicate buttons
-             are not allowed. Unknown button names are silently ignored
-             so that buttons can be added in future gnome-shell versions
-             without breaking older versions.
-             A special spacer tag can be used to insert some space between
-             two adjacent buttons.
-
-             This key overrides /apps/metacity/general/button_layout when
-             running GNOME Shell.
-           </long>
-        </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/desktop/gnome/shell/windows/edge_tiling</key>
-        <applyto>/desktop/gnome/shell/windows/edge_tiling</applyto>
-        <owner>gnome-shell</owner>
-        <type>bool</type>
-        <default>true</default>
-        <locale name="C">
-          <short>enable edge tiling when dropping windows on screen edges</short>
-          <long>
-             If enabled, dropping windows on vertical screen edges maximizes them
-             vertically and resizes them horizontally to cover half of the
-             available area. Dropping windows on the top screen edge maximizes them
-             completely.
-
-             This key overrides /apps/metacity/general/edge_tiling when
-             running GNOME Shell.
-          </long>
-        </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/desktop/gnome/shell/windows/theme</key>
-        <applyto>/desktop/gnome/shell/windows/theme</applyto>
-        <owner>gnome-shell</owner>
-        <type>string</type>
-        <default>Adwaita</default>
-        <locale name="C">
-          <short>Current theme</short>
-          <long>
-            The theme determines the appearance of window borders,
-            titlebar, and so forth.
-
-            This key overrides /apps/metacity/general/theme when
-            running GNOME Shell.
-          </long>
-        </locale>
-      </schema>
-
-      <schema>
-        <key>/schemas/desktop/gnome/shell/windows/workspaces_only_on_primary</key>
-        <applyto>/desktop/gnome/shell/windows/workspaces_only_on_primary</applyto>
-        <owner>gnome-shell</owner>
-        <type>bool</type>
-        <default>true</default>
-        <locale name="C">
-          <short>Workspaces only on primary monitor</short>
-          <long>
-             This key overrides /apps/mutter/general/workspaces_only_on_primary when
-             running GNOME Shell.
-          </long>
-        </locale>
-      </schema>
-
-  </schemalist>
-</gconfschemafile>
index ea822eebfa3253b7d4d8faec6f0f9b690c59080d..a6438f02d8eddb39256907561b6959276eb8296d 100644 (file)
       </_description>
     </key>
   </schema>
+
+  <schema id="org.gnome.shell.overrides" path="/org/gnome/shell/overrides/">
+    <key name="attach-modal-dialogs" type="b">
+      <default>true</default>
+      <summary>Attach modal dialog to the parent window</summary>
+      <description>
+        This key overrides the key in org.gnome.mutter when running
+        GNOME Shell.
+      </description>
+    </key>
+
+    <key name="button-layout" type="s">
+      <default>":close"</default>
+      <summary>Arrangement of buttons on the titlebar</summary>
+      <description>
+        This key overrides the key in org.gnome.desktop.wm.preferences when
+        running GNOME Shell.
+      </description>
+    </key>
+
+    <key name="edge-tiling" type="b">
+      <default>true</default>
+      <summary>Enable edge tiling when dropping windows on screen edges</summary>
+      <description>
+        This key overrides the key in org.gnome.mutter when running GNOME Shell.
+      </description>
+    </key>
+
+    <key name="workspaces-only-on-primary" type="b">
+      <default>true</default>
+      <summary>Workspaces only on primary monitor</summary>
+      <description>
+        This key overrides the key in org.gnome.mutter when running GNOME Shell.
+      </description>
+    </key>
+  </schema>
 </schemalist>
index 20bad20d095942b66f9b8fa924cd3592326b80db..5aaa8d492337edd798f10268d7c9d4488ce47619 100644 (file)
@@ -199,7 +199,7 @@ AltTabPopup.prototype = {
         this.actor.get_allocation_box();
 
         // Make the initial selection
-        if (binding == 'switch_group') {
+        if (binding == 'switch-group') {
             if (backward) {
                 this._select(0, this._appIcons[0].cachedWindows.length - 1);
             } else {
@@ -208,9 +208,9 @@ AltTabPopup.prototype = {
                 else
                     this._select(0, 0);
             }
-        } else if (binding == 'switch_group_backward') {
+        } else if (binding == 'switch-group-backward') {
             this._select(0, this._appIcons[0].cachedWindows.length - 1);
-        } else if (binding == 'switch_windows_backward') {
+        } else if (binding == 'switch-windows-backward') {
             this._select(this._appIcons.length - 1);
         } else if (this._appIcons.length == 1) {
             this._select(0);
index aa7322062feb7058abca645dbb191370b3b5e824..495b987eeab8d96712778236846baca61ef85e59 100644 (file)
@@ -2,7 +2,6 @@
 
 const Clutter = imports.gi.Clutter;
 const Cogl = imports.gi.Cogl;
-const GConf = imports.gi.GConf;
 const GLib = imports.gi.GLib;
 const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
index 6bd5f59dcaaf2ce0ee5cf38835fd32911313e25f..6849292e0ee0eea81c03fc41c076f66039131b4b 100644 (file)
@@ -4,7 +4,6 @@ const Clutter = imports.gi.Clutter;
 const Gdk = imports.gi.Gdk;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
-const GConf = imports.gi.GConf;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
@@ -135,13 +134,13 @@ function _initUserSession() {
 
     let shellwm = global.window_manager;
 
-    shellwm.takeover_keybinding('panel_run_dialog');
-    shellwm.connect('keybinding::panel_run_dialog', function () {
+    shellwm.takeover_keybinding('panel-run-dialog');
+    shellwm.connect('keybinding::panel-run-dialog', function () {
        getRunDialog().open();
     });
 
-    shellwm.takeover_keybinding('panel_main_menu');
-    shellwm.connect('keybinding::panel_main_menu', function () {
+    shellwm.takeover_keybinding('panel-main-menu');
+    shellwm.connect('keybinding::panel-main-menu', function () {
         overview.toggle();
     });
 
@@ -577,16 +576,6 @@ function _globalKeyPressHandler(actor, event) {
     // This relies on the fact that Clutter.ModifierType is the same as Gdk.ModifierType
     let action = global.display.get_keybinding_action(keyCode, modifierState);
 
-    // The screenshot action should always be available (even if a
-    // modal dialog is present)
-    if (action == Meta.KeyBindingAction.COMMAND_SCREENSHOT) {
-        let gconf = GConf.Client.get_default();
-        let command = gconf.get_string('/apps/metacity/keybinding_commands/command_screenshot');
-        if (command != null && command != '')
-            Util.spawnCommandLine(command);
-        return true;
-    }
-
     // Other bindings are only available to the user session when the overview is up and
     // no modal dialog is present.
     if (global.session_type == Shell.SessionType.USER && (!overview.visible || modalCount > 1))
index 15fe8c9c7e78c892cbe3ccb912d43fc308c827d3..0c6ef7c4f8466eb7884557031bd7710ffe6bcf05 100644 (file)
@@ -1,6 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-const GConf = imports.gi.GConf;
+const DBus = imports.dbus;
+const GDesktopEnums = imports.gi.GDesktopEnums;
 const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
@@ -29,8 +30,8 @@ const DPI_FACTOR_LARGE   = 1.25;
 const DPI_FACTOR_LARGER  = 1.5;
 const DPI_FACTOR_LARGEST = 2.0;
 
-const KEY_META_DIR       = '/apps/metacity/general';
-const KEY_VISUAL_BELL = KEY_META_DIR + '/visual_bell';
+const WM_SCHEMA            = 'org.gnome.desktop.wm.preferences';
+const KEY_VISUAL_BELL_TYPE = 'visual-bell-type';
 
 const DESKTOP_INTERFACE_SCHEMA = 'org.gnome.desktop.interface';
 const KEY_GTK_THEME      = 'gtk-theme';
@@ -49,10 +50,6 @@ ATIndicator.prototype = {
     _init: function() {
         PanelMenu.SystemStatusButton.prototype._init.call(this, 'preferences-desktop-accessibility', null);
 
-        let client = GConf.Client.get_default();
-        client.add_dir(KEY_META_DIR, GConf.ClientPreloadType.PRELOAD_ONELEVEL, null);
-        client.notify_add(KEY_META_DIR, Lang.bind(this, this._keyChanged), null, null);
-
         let highContrast = this._buildHCItem();
         this.menu.addMenuItem(highContrast);
 
@@ -71,7 +68,7 @@ ATIndicator.prototype = {
                                                                    'screen-keyboard-enabled');
         this.menu.addMenuItem(screenKeyboard);
 
-        let visualBell = this._buildItemGConf(_("Visual Alerts"), client, KEY_VISUAL_BELL);
+        let visualBell = this._buildVisualBellItem();
         this.menu.addMenuItem(visualBell);
 
         let stickyKeys = this._buildItem(_("Sticky Keys"), A11Y_SCHEMA, KEY_STICKY_KEYS_ENABLED);
@@ -101,22 +98,6 @@ ATIndicator.prototype = {
         return widget;
     },
 
-    _buildItemGConf: function(string, client, key) {
-        function on_get() {
-            return client.get_bool(key);
-        }
-        let widget = this._buildItemExtended(string,
-            client.get_bool(key),
-            client.key_is_writable(key),
-            function(enabled) {
-                client.set_bool(key, enabled);
-            });
-        this.connect('gconf-changed', function() {
-            widget.setToggleState(client.get_bool(key));
-        });
-        return widget;
-    },
-
     _buildItem: function(string, schema, key) {
         let settings = new Gio.Settings({ schema: schema });
         let widget = this._buildItemExtended(string,
@@ -131,6 +112,27 @@ ATIndicator.prototype = {
         return widget;
     },
 
+    _buildVisualBellItem: function() {
+        let settings = new Gio.Settings({ schema: WM_SCHEMA });
+        let currentValue = settings.get_enum(KEY_VISUAL_BELL_TYPE);
+        let visualBellItem = this._buildItemExtended(
+            _("Visual Alerts"),
+            currentValue != GDesktopEnums.VisualBellType.NONE,
+            settings.is_writable(KEY_VISUAL_BELL_TYPE),
+            function(enabled) {
+                if (enabled)
+                    settings.set_enum(KEY_VISUAL_BELL_TYPE,
+                                      GDesktopEnums.VisualBellType.FULLSCREEN_FLASH);
+                else
+                    settings.reset(KEY_VISUAL_BELL_TYPE);
+            });
+        settings.connect('changed::' + KEY_VISUAL_BELL_TYPE, function() {
+            let value = settings.get_enum(KEY_VISUAL_BELL_TYPE);
+            visualBellItem.setToggleState(value != GDesktopEnums.VisualBellType.NONE);
+        });
+        return visualBellItem;
+    },
+
     _buildHCItem: function() {
         let settings = new Gio.Settings({ schema: DESKTOP_INTERFACE_SCHEMA });
         let gtkTheme = settings.get_string(KEY_GTK_THEME);
@@ -190,10 +192,6 @@ ATIndicator.prototype = {
             widget.setToggleState(active);
         });
         return widget;
-    },
-
-    _keyChanged: function() {
-        this.emit('gconf-changed');
     }
 };
 Signals.addSignalMethods(ATIndicator.prototype);
index d827b22bbe5f2dc085507ea48912c9d9014f00f8..b9b4181df93eccd84fcea72afb395d2328f6fefa 100644 (file)
@@ -121,15 +121,15 @@ WindowManager.prototype = {
         this._shellwm.connect('destroy', Lang.bind(this, this._destroyWindow));
 
         this._workspaceSwitcherPopup = null;
-        this.setKeybindingHandler('switch_to_workspace_left', Lang.bind(this, this._showWorkspaceSwitcher));
-        this.setKeybindingHandler('switch_to_workspace_right', Lang.bind(this, this._showWorkspaceSwitcher));
-        this.setKeybindingHandler('switch_to_workspace_up', Lang.bind(this, this._showWorkspaceSwitcher));
-        this.setKeybindingHandler('switch_to_workspace_down', Lang.bind(this, this._showWorkspaceSwitcher));
-        this.setKeybindingHandler('switch_windows', Lang.bind(this, this._startAppSwitcher));
-        this.setKeybindingHandler('switch_group', Lang.bind(this, this._startAppSwitcher));
-        this.setKeybindingHandler('switch_windows_backward', Lang.bind(this, this._startAppSwitcher));
-        this.setKeybindingHandler('switch_group_backward', Lang.bind(this, this._startAppSwitcher));
-        this.setKeybindingHandler('switch_panels', Lang.bind(this, this._startA11ySwitcher));
+        this.setKeybindingHandler('switch-to-workspace-left', Lang.bind(this, this._showWorkspaceSwitcher));
+        this.setKeybindingHandler('switch-to-workspace-right', Lang.bind(this, this._showWorkspaceSwitcher));
+        this.setKeybindingHandler('switch-to-workspace-up', Lang.bind(this, this._showWorkspaceSwitcher));
+        this.setKeybindingHandler('switch-to-workspace-down', Lang.bind(this, this._showWorkspaceSwitcher));
+        this.setKeybindingHandler('switch-windows', Lang.bind(this, this._startAppSwitcher));
+        this.setKeybindingHandler('switch-group', Lang.bind(this, this._startAppSwitcher));
+        this.setKeybindingHandler('switch-windows-backward', Lang.bind(this, this._startAppSwitcher));
+        this.setKeybindingHandler('switch-group-backward', Lang.bind(this, this._startAppSwitcher));
+        this.setKeybindingHandler('switch-panels', Lang.bind(this, this._startA11ySwitcher));
 
         Main.overview.connect('showing', Lang.bind(this, function() {
             for (let i = 0; i < this._dimmedWindows.length; i++)
@@ -556,15 +556,15 @@ WindowManager.prototype = {
         if (this._workspaceSwitcherPopup == null)
             this._workspaceSwitcherPopup = new WorkspaceSwitcherPopup.WorkspaceSwitcherPopup();
 
-        if (binding == 'switch_to_workspace_up')
+        if (binding == 'switch-to-workspace-up')
             this.actionMoveWorkspaceUp();
-        else if (binding == 'switch_to_workspace_down')
+        else if (binding == 'switch-to-workspace-down')
             this.actionMoveWorkspaceDown();
         // left/right would effectively act as synonyms for up/down if we enabled them;
         // but that could be considered confusing.
-        // else if (binding == 'switch_to_workspace_left')
+        // else if (binding == 'switch-to-workspace-left')
         //   this.actionMoveWorkspaceLeft();
-        // else if (binding == 'switch_to_workspace_right')
+        // else if (binding == 'switch-to-workspace-right')
         //   this.actionMoveWorkspaceRight();
     },
 
index cf22acdcbf1ce01c1ca0383ecebbfb56d89b23fc..97b0893a7be06f49d92a61f7a821888e5f2ae076 100644 (file)
@@ -1,7 +1,7 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
 const Clutter = imports.gi.Clutter;
-const GConf = imports.gi.GConf;
+const Gio = imports.gi.Gio;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
@@ -28,7 +28,8 @@ const CLOSE_BUTTON_FADE_TIME = 0.1;
 
 const DRAGGING_WINDOW_OPACITY = 100;
 
-const BUTTON_LAYOUT_KEY = '/desktop/gnome/shell/windows/button_layout';
+const BUTTON_LAYOUT_SCHEMA = 'org.gnome.shell.overrides';
+const BUTTON_LAYOUT_KEY = 'button-layout';
 
 // Define a layout scheme for small window counts. For larger
 // counts we fall back to an algorithm. We need more schemes here
@@ -527,8 +528,8 @@ WindowOverlay.prototype = {
         let button = this.closeButton;
         let title = this.title;
 
-        let gconf = GConf.Client.get_default();
-        let layout = gconf.get_string(BUTTON_LAYOUT_KEY);
+        let settings = new Gio.Settings({ schema: BUTTON_LAYOUT_SCHEMA });
+        let layout = settings.get_string(BUTTON_LAYOUT_KEY);
         let rtl = St.Widget.get_default_direction() == St.TextDirection.RTL;
 
         let split = layout.split(":");
index 6cc66f83d54a5466c30a0dfc5fcc16b154ae672e..81cdce94a855c4831134cc7cc2ca9e1a9d9f87ea 100644 (file)
@@ -33,6 +33,8 @@ extern GType gnome_shell_plugin_get_type (void);
 #define SHELL_DBUS_SERVICE "org.gnome.Shell"
 #define MAGNIFIER_DBUS_SERVICE "org.gnome.Magnifier"
 
+#define OVERRIDES_SCHEMA "org.gnome.shell.overrides"
+
 static gboolean is_gdm_mode = FALSE;
 
 #define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1
@@ -309,16 +311,14 @@ shell_fonts_init (void)
 static void
 shell_prefs_init (void)
 {
-  meta_prefs_override_preference_location ("/apps/mutter/general/attach_modal_dialogs",
-                                           "/desktop/gnome/shell/windows/attach_modal_dialogs");
-  meta_prefs_override_preference_location ("/apps/mutter/general/workspaces_only_on_primary",
-                                           "/desktop/gnome/shell/windows/workspaces_only_on_primary");
-  meta_prefs_override_preference_location ("/apps/metacity/general/button_layout",
-                                           "/desktop/gnome/shell/windows/button_layout");
-  meta_prefs_override_preference_location ("/apps/metacity/general/edge_tiling",
-                                           "/desktop/gnome/shell/windows/edge_tiling");
-  meta_prefs_override_preference_location ("/apps/metacity/general/theme",
-                                           "/desktop/gnome/shell/windows/theme");
+  meta_prefs_override_preference_schema ("attach-modal-dialogs",
+                                         OVERRIDES_SCHEMA);
+  meta_prefs_override_preference_schema ("workspaces-only-on-primary",
+                                         OVERRIDES_SCHEMA);
+  meta_prefs_override_preference_schema ("button-layout",
+                                         OVERRIDES_SCHEMA);
+  meta_prefs_override_preference_schema ("edge-tiling",
+                                         OVERRIDES_SCHEMA);
 }
 
 /* This is an IBus workaround. The flow of events with IBus is that every time